package com.git.bds.mr.doctor.mapper;

import com.git.bds.mr.doctor.model.domain.Doctor;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 医生信息表 Mapper 接口
 * </p>
 *
 * @author 成大事
 * @since 2022-09-19 16:41:33
 */
@Mapper
public interface DoctorMapper extends MPJBaseMapper<Doctor> {

    /**
     * 获取医院信息
     *
     * @param doctorId 医生id
     * @return {@link Long}
     */
    @Select("SELECT\n" +
            "\th.id,h.`name` \n" +
            "FROM\n" +
            "\tdoctor d\n" +
            "\tLEFT JOIN sector s on d.sector_id = s.id\n" +
            "\tLEFT JOIN hospital h on s.hospital_id = h.id\n" +
            "\tWHERE d.id = #{id};")
    Long getHospitalInfo(@Param("id") long doctorId);
}
